//
//  User_GetInfo_Task.m
//  EpointFrame5
//
//  Created by 李亚春 on 14-2-10.
//  Copyright (c) 2014年 Epoint. All rights reserved.
//

#import "User_GetInfo_Task.h"

@implementation User_GetInfo_Task

-(void)execute
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    NSString *ValidateData = [EpointBizTools getToken];
    NSString *url = self.getMobileOAWebserviceURL;
    NSString *wsNamespace = NSLocalizedString(@"Epoint_DNet_WS_NameSpace", @"");
    NSString *userguid = [userDefaults objectForKey:Epoint_User_UserGuid];
    
    NSString *ParasXml = @"<![CDATA[<?xml version=\"1.0\" encoding=\"gb2312\"?><paras><UserGuid>%@</UserGuid></paras>]]>";
    
    ParasXml = [NSString stringWithFormat:ParasXml,userguid];
    
    
    //请求接口
    EpointWebServiceUtil *ws = [[EpointWebServiceUtil alloc]initWithUrl:url namespace:wsNamespace method:@"User_GetInfo"];
    [ws addParameterForString:@"ValidateData" value:ValidateData];
    [ws addParameterForString:@"ParasXml" value:ParasXml];
    NSString *bs =  ws.start;
    
    NSString *UserArea = [EpointStringUtil getXMLFormatedAttribute:bs :@"UserArea"];
    if (UserArea && ![UserArea isEqualToString:@""]) {
        [DBFrameService setConfigValue:ParasXml value:bs];
        NSMutableArray *arr = [[NSMutableArray alloc]init];
        [arr addObject:[EpointStringUtil getXMLFormatedAttribute:bs :@"NewMailsCount"]];
        [arr addObject:[EpointStringUtil getXMLFormatedAttribute:bs :@"NewWaitHandleCount"]];
        [arr addObject:[EpointStringUtil getXMLFormatedAttribute:bs :@"MailReceiveCount"]];
        [arr addObject:[EpointStringUtil getXMLFormatedAttribute:bs :@"MailSendCount"]];
        [arr addObject:[EpointStringUtil getXMLFormatedAttribute:bs :@"DraftMailCount"]];
        [arr addObject:[EpointStringUtil getXMLFormatedAttribute:bs :@"TaskMailCount"]];
        [self exeSuccessWithData:arr];
    }
}


@end
